﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;

using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.BehaviorTree;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.Logic.POI;
using Styx.WoWInternals.WoWObjects;
using TreeSharp;
using Action = TreeSharp.Action;
using Sequence = TreeSharp.Sequence;
using Styx.WoWInternals;


namespace Healz
{
    public class Healz : BotBase
    {
        #region Overrides of BotBase

        public Healz()
        {
            Druid.Main.Settings = new Druid.Config();
        }


        private Composite _root;
        public override Composite Root
        {
            get { return _root ?? (_root = new PrioritySelector( CreateCombatBehavior())); }
        }


        public override string Name
        {
            get { return "Healz"; }
        }

        public override PulseFlags PulseFlags
        {
            get { return PulseFlags.All; }
        }

        public override void Start()
        {
            StyxSettings.Instance.LogoutForInactivity = false;
            Utils.Write("Starting");
        }

        public override void Stop()
        {
            StyxSettings.Instance.LogoutForInactivity = true;
            Utils.Write("Ended");
        }


        // Dunno why but this stops it from not working ?
        internal static Composite CreateCombatBehavior()
        {
            return new PrioritySelector();
        }


        #endregion

        public override void Pulse()
        {
            // no good fucken
            if (!Utils.IsBotEnabled) return;

            Utils.WriteDebug("Tick Fucken");
            // good fucken
            switch (ObjectManager.Me.Class)
            {
                case WoWClass.Druid:
                    // Pulse fucken
                    Druid.Main.Pulse(0);
                    break;
                case WoWClass.Paladin:
                    break;
                case WoWClass.Priest:
                    break;
                case WoWClass.Shaman:
                    break;
                default:
                    break;
            }
        }
    }
}
